home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
ici
/
ici.cpi
/
func.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-10-27
|
1KB
|
55 lines
#ifndef ICI_FUNC_H
#define ICI_FUNC_H
#ifndef ICI_OBJECT_H
#include "object.h"
#endif
struct func
{
object_t o_head;
array_t *f_code; /* The code of this function, atom. */
array_t *f_args; /* Array of argument names. */
struct_t *f_autos; /* Prototype struct of autos (incl. args). */
string_t *f_name; /* Some name for the function (diagnostics). */
};
struct cfunc
{
object_t o_head;
char *cf_name;
int (*cf_cfunc)();
int (*cf_arg1)();
char *cf_arg2;
};
#define cfuncof(o) ((cfunc_t *)(o))
#define funcof(o) ((func_t *)(o))
#define isfunc(o) ((o)->o_type == &func_type)
#define O_CFUNC 0x10
#define CF_OBJ {0, O_ATOM|O_CFUNC, 1, 0, &func_type}
/*
* The n'th argument (first is 0) during execution of a function's C code.
*/
#define ARG(n) (o_top[-2 - n])
/*
* Count of actual arguments to this C function.
*/
#define NARGS() (opof(x_top[-1])->op_code)
/*
* A pointer to the first arg to this C function, decrement for next
* and subsequent.
*/
#define ARGS() (&o_top[-2])
/*
* Return the cf_arg1 and cf_arg2 fields of the current C function.
* The first is a function pointer, the second a char *.
*/
#define CF_ARG1() (cfuncof(o_top[-1])->cf_arg1)
#define CF_ARG2() (cfuncof(o_top[-1])->cf_arg2)
#endif